package io.renren.common.constants.enums;

import com.alibaba.fastjson.annotation.JSONType;
import lombok.Getter;

import java.util.Arrays;

/**
 * 支付类型枚举
 */
@Getter
public enum PayType implements EnumValue{
    WX(1,"微信"),
    ALI(2,"支付宝"),
    BALANCE(3,"余额"),
    IOS(4,"ios内购"),
    ;

    /**值*/
    private int value;
    /**描述*/
    private String desc;

    PayType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 获取枚举
     *
     * @return
     */
    public static PayType getByCode(int code) {
        return Arrays.stream(values()).filter(e -> e.getValue() == code).findFirst().orElse(WX);
    }

    @Override
    public int value() {
        return this.value;
    }
    @Override
    public String toString() {
        return this.value+"";
    }
}
